//index.js
//获取应用实例
var app = getApp();
let constants = require('../../../../common/Constants.js');
let network_utils = require('../../../../http/NetworkUtils.js');

import DeployingList from '../../../../templates/DeployingList/DeployingList';

Page(Object.assign({

    paramsData: null,
    pageNo: "1",

    data: {
        storeList: [],
        hasMore: false,
    },

    onLoad: function (options) {
        let params = JSON.parse(options.params);
        this.paramsData = JSON.parse(params.optionsData);
        this.pageNo = "1";
        this._requestList();
    },

    _requestList: function () {
        let params = {
            storeStatus: "0",
            agentId: this.paramsData.agentId,
            storeName: this.paramsData.storeName,
            startDate: this.paramsData.startDate,
            endDates: this.paramsData.endDates,
            pageNo: this.pageNo,
            pageSize: app.globalData.pageSize
        };
        network_utils.buildRequest(constants.Interfaces.FUNC_SEARCH_STORES, params, {
            doHttpSucess: (response) => {
                if (constants.RetCodes.SUCCESS === response.retCode) {
                    this._requestSuccess(response);
                    return true;
                }
                return false;
            },
        }).send();
    },

    /**
     * 加载更多事件
     */
    loadMore: function () {
        this._requestList();
    },
}, DeployingList));
